<template>
  <div class="mytree">
    <el-tree
      style="height: 100%;width: 200px;padding: 20px;border-radius: 5px"
      check-strictly
      :data="treeData"
      node-key="id"
      :props="defaultProps"
      @node-click="handleNodeClick">
    </el-tree>
  </div>

</template>

<script>

import { businessHallTree } from '@/api/business-hall'

export default {
  name: 'operationCenter',
  data () {
    return {
      treeData: [],
      defaultProps: {
        label: 'name'
      }
    }
  },
  created () {
    this.getTree()
  },
  methods: {
    async getTree () {
      const { data } = await businessHallTree()
      const newdata = JSON.parse(data)
      this.treeData = newdata
      // console.log(this.treeData)
    },
    handleNodeClick (data) {
      // console.log(data.id)
      this.$emit('getId', data.id)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
